<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@taglib uri="/struts-tags" prefix="s"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib prefix="ck" uri="http://ckeditor.com"%>  
<html>
<head>
<title>网络新闻应急性管理系统</title>

<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="/res/style/common.css">
<link rel="stylesheet" type="text/css" href="/res/style/admin.css">
<link rel="stylesheet" type="text/css" href="/res/style/newsEdit.css">
<script type="text/javascript" src="/res/script/menu.js"></script>
<script type="text/javascript">
	function isValidated(){
		var msg = "";
		if(document.getElementById('id_topLine').checked == true)
			document.getElementById('news.topLine').value = '1';
		else 
			document.getElementById('news.topLine').value = '0';
		if(document.getElementById('news.mainTitle').value == null || document.getElementById('news.mainTitle').value == "")
			msg += "\n主标题  不能为空!";
		if(document.getElementById('news.keyword').value == null || document.getElementById('news.keyword').value == "")
			msg += "\n关键字  不能为空!";
		if(msg != ""){
			alert("提示：" + msg);
			return false;
		}
		return true;
	}
</script>
</head>
<body onload="addMenu();">
	<div class="MainDiv">
		<div class="AjustDiv">
			<jsp:include page="/page/admin/adminHeader.jsp"></jsp:include>
			<jsp:include page="/page/admin/adminLeft.html"></jsp:include>
			<!-- 内容部分 -->
			<div class="ContentDiv">
				<div class="DetailDiv">
					<form action="newsManage.action?id=${news.id}&act=update" method="post">
						<div class="ItemDiv"><h2>编辑新闻</h2></div>
						<div class="ItemDiv">
							<table>
								<tr>
									<td style="text-align: right;"><label>主标题：</label>
									</td>
									<td><input type="text" name="news.mainTitle" id="id_MainTitle" value="${news.mainTitle}">
									</td>
									<td style="text-align: right;"><label>副标题：</label>
									</td>
									<td><input type="text" name="news.subTitle" value="${news.subTitle}">
									</td>
								</tr>
								<tr>
									<td style="text-align: right;"><label>辅助标题：</label>
									</td>
									<td><input type="text" name="news.assistTitle" value="${news.assistTitle}"><label class="Tips">*</label>
									</td>
									<td style="text-align: right;"><label>导语：</label>
									</td>
									<td><input type="text" name="news.introduction" value="${news.introduction}">
									</td>
								</tr>
								<tr>
									<td style="text-align: right;"><label>背景：</label>
									</td>
									<td><input type="text" name="news.background" value="${news.background}">
									</td>
									<td style="text-align: right;"><label>结语：</label>
									</td>
									<td><input type="text" name="news.conclusion" value="${news.conclusion}">
									</td>
								</tr>
								<tr>
									<td style="text-align: right;"><label>来源：</label>
									</td>
									<td><input type="text" name="news.origin" value="${news.origin}">
									</td>
									<td style="text-align: right;"><label>发布者：</label>
									</td>
									<td><input type="text" disabled="disabled" name="publisher" value="${news.publisher.username}">
									</td>
								</tr>
								<tr>
									<td style="text-align: right;"><label>类型：</label>
									</td>
									<td>
										<select name="news.type.id">
											<c:forEach items="${newsTypes}"  var="t" varStatus="tStatus">
												<c:if test="${t.type == 1}">
													<option value="${t.id}" <c:if test="${t.id == news.type.id}">selected="selected"</c:if>>${t.content}</option>
												</c:if>
											</c:forEach>
										</select><label class="Tips">*</label>
										<select name="news.type2.id">
											<c:forEach items="${newsTypes}"  var="t" varStatus="tStatus">
												<c:if test="${t.type == 2}">
													<option value="${t.id}" <c:if test="${t.id == news.type2.id}">selected="selected"</c:if>>${t.content}</option>
												</c:if>
											</c:forEach>
										</select><label class="Tips">*</label>
										<select name="news.type3.id">
											<c:forEach items="${newsTypes}"  var="t" varStatus="tStatus">
												<c:if test="${t.type == 3}">
													<option value="${t.id}" <c:if test="${t.id == news.type3.id}">selected="selected"</c:if>>${t.content}</option>
												</c:if>
											</c:forEach>
										</select><label class="Tips">*</label>
									</td>
									
									<td style="text-align: right;"><label>紧急程度：</label>
									</td>
									<td>
										<select
										name="news.degree" id="id_DegreeSelecter">
											<option value="1" <c:if test="${news.degree == 1}">selected="selected"</c:if>>一般</option>
											<option value="2" <c:if test="${news.degree == 2}">selected="selected"</c:if>>较紧急</option>
											<option value="3" <c:if test="${news.degree == 3}">selected="selected"</c:if>>紧急</option>
											<option value="4" <c:if test="${news.degree == 4}">selected="selected"</c:if>>很紧急</option>
											<option value="5" <c:if test="${news.degree == 5}">selected="selected"</c:if>>超紧急</option>
									</select><label class="Tips">*</label>
									</td>
								</tr>
								<tr>
									<td style="text-align: right;"><label>发布时间：</label>
									</td>
									<td>
										<input type="datetime" disabled="disabled" value="${news.releaseTime}">
									</td>
									<td style="text-align: right;"><label>生命周期：</label>
									</td>
									<td><input type="date" value="${news.activeTime}">
									</td>
								</tr>
								<tr>
									<td></td>
									<td>
										<input type="checkbox" <c:if test="${news.topLine == 1}">checked="checked"</c:if> title="标记为头条" id="id_topLine">
										<input type="text" name="news.topLine" value="0" hidden="true" id="news.topLine">
										<label>标记为头条</label>
									</td>
									<td style="text-align: right;"><label>关键字：</label>
									</td>
									<td><input type="text" name="news.keyword" value="${news.keyword}"><label class="Tips">*（以逗号隔开）</label>
									</td>
								</tr>
								<tr>
									<td style="text-align: right;"><label>评论：</label> 
									</td>
									<td>
										<input style="width:70px;text-align: center;" disabled="disabled"
										type="text" name="news.commentCount" value="${news.commentCount}">
										<label>关注：</label> 
										<input
											style="width:70px;text-align: center;" disabled="disabled"
											type="text" name="news.concernCount" value="${news.concernCount}">
									</td>
									<td style="text-align: right;"><label>转播：</label></td>
									<td>
										<input style="width:70px;text-align: center;"
											disabled="disabled" type="text" name="news.rebroadcast" value="${news.rebroadcast}">
										<label>分享：</label>
										<input style="width:70px;text-align: center;"
											disabled="disabled" type="text" value="0">
									</td>
								</tr>
							</table>
						</div>
						<div class="ItemDiv">
							<textarea class="ckeditor" name="news.content" id="news.content"
									rows="36" cols="105">${news.content}</textarea>  
					        <ck:replace replace="news.content" basePath="res/ckeditor"></ck:replace> 
						</div>
						<div class="ItemDiv">
							<div style="text-align:left;padding:5px;">
								<button type="submit" onclick="return isValidated();">提交</button>
								<button type="reset" onclick="">重置</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
	<jsp:include page="/page/admin/adminFooter.html"></jsp:include>
</body>
</html>
